<?php

namespace App\Enums;

use App\Traits\EnumTrait;

class OrderChangeTypeEnum
{

    use EnumTrait;

    const ENUM = [
        ['type' => 1, 'code' => 'PRICE', 'text' => '价格'],
        ['type' => 2, 'code' => 'ACTIVITY', 'text' => '活动信息']
    ];

    const PRICE = 1;
    const ACTIVITY = 2;


    public static function getEnumByType($changeType): ?array
    {
        foreach (self::getConstants() as $item) {
            if ($changeType == $item['type']) {
                return $item;
            }
        }
        return null;
    }
}
